package com.ruoyi.quartz.task;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.quartz.util.TestTable2;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.AdminPrizeRecord;
import com.ruoyi.system.domain.AdminPrizeRecord;
import com.ruoyi.system.service.*;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;

import static com.ruoyi.quartz.task.RyTask.*;
import static com.ruoyi.quartz.util.TestTable2.graphicsStart;

/**
 * @program: ruoyi
 * @description: 澳洲
 * @author: Mr.sun
 * @create: 2021-06-20 23:17
 **/
@Component("luckTask")
public class LuckTask {

    private static final Logger logger = LoggerFactory.getLogger(LuckTask.class);

    @Autowired
    private IAdminPrizeRecordService iAdminPrizeRecordService;

    @Autowired
    private IAdminPrizeConfigService iAdminPrizeConfigService;

    @Autowired
    private IAdminAgentInfoService iAdminAgentInfoService;

    @Autowired
    private IAdminUserBetRecordService iAdminUserBetRecordService;

    @Autowired
    private   IAdminWeixinUserService iAdminWeixinUserService;

    @Autowired
    private IAdminAgentRobotService iAdminAgentRobotService;

    @Autowired
    private IAdminUpdownBranchService iAdminUpdownBranchService;

    @Autowired
    private IAdminLuckyCommandService iAdminLuckyCommandService;

    @Autowired
    private IAdminPumpRecordService iAdminPumpRecordService;


    @Autowired
    private IAdminUserFlowingService iAdminUserFlowingService;

    @Autowired
    private IAdminLuckyCommandService luckyCommandService;

    @Value("${send.url}")
    private String sendUrl;

    @Value("${send.urlOne}")
    private String sendUrlOne;

    @Value("${send.urlTwo}")
    private String sendUrlTwo;


    private Integer min=5;


    public void drawLuck() {
        logger.info("------------------------澳洲8正常开奖流程---------------------------");
        Map<String, Object> stringObjectMap = iAdminPrizeRecordService.selectAdminPrizeRecordCount();
        AdminPrizeConfig stateInfo = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("state");
        AdminPrizeConfig intervalInfo = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("interval");

        if (stateInfo.getConfigValue().equals("2")) {
            return;
        }
//        iAdminPrizeRecordService.updatePrizeState();
        if (Integer.valueOf(stringObjectMap.get("count").toString()).intValue() == 0) {
            return;
        }

        //有修改时间，没开奖的记录
        AdminPrizeRecord prizeRecord = new AdminPrizeRecord();
        AdminPrizeRecord notPrizeRecord = iAdminPrizeRecordService.selectAdminPrizeRecordByPrizeTime();
        //初始化未开过奖时，会有为空的情况，如果为空，将期数最小的数据找出
        if (notPrizeRecord == null) {
            notPrizeRecord = iAdminPrizeRecordService.getMinPrizeInfoByPeriod();
            //如果这里还是为空，可能是另一个调度还未预先生成号码，先返回
            if (notPrizeRecord == null) {
                return;
            }
            prizeRecord.setPrizeTime(DateUtils.getNowDate());
            prizeRecord.setRecordId(notPrizeRecord.getRecordId());
            prizeRecord.setState(2);
            iAdminPrizeRecordService.updateAdminPrizeRecord(prizeRecord);
            logger.info(prizeRecord.toString());
        }  else {
//            AdminPrizeConfig oddsInfo = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("odds");
            AdminPrizeConfig sealingTime = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("sealingTime");
            int sealingTimeValue = Integer.valueOf(sealingTime.getConfigValue()).intValue();
            AdminPrizeRecord sealingPrizeRecord = iAdminPrizeRecordService.selectAdminPrizeRecordById(notPrizeRecord.getRecordId());
            //封盘时间
            Date sealingDate = DateUtils.addMinutes(notPrizeRecord.getPrizeTime(), -sealingTimeValue);
            //提前30秒封盘时间
            Date advanceDate = DateUtils.addSeconds(sealingDate, -30);
            //封盘前给代理发消息
            if (DateUtils.getNowDate().getTime() >= advanceDate.getTime() && sealingPrizeRecord.getSealingState() == 0) {
                //修改已提前发过消息
                AdminPrizeRecord updatePrizeRecord = new AdminPrizeRecord();
                updatePrizeRecord.setRecordId(notPrizeRecord.getRecordId());
                updatePrizeRecord.setSealingState(1);
                iAdminPrizeRecordService.updateAdminPrizeRecord(updatePrizeRecord);
                AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
                String sendMsg="30秒后封盘!";
                List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
                if (adminAgentInfos.size() > 0) {
                    for (AdminAgentInfo agentInfo : adminAgentInfos) {
                        if (agentInfo.getAgentState()==1 && agentInfo.getAgentType()==1) {
                            String room = agentInfo.getRoom();
                            HttpUtils.sendPost(sendUrl, "sendMsg=" + sendMsg + "&room=" + room);
                        }
                    }
                }
                System.gc();
            }
            if (DateUtils.getNowDate().getTime() >= sealingDate.getTime() && sealingPrizeRecord.getSealingState() == 1) {
                AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
                adminAgentInfo.setAgentType(2);
                List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
                if (adminAgentInfos.size() > 0) {
                    for (AdminAgentInfo agentInfo:adminAgentInfos) {
                        if (agentInfo.getAgentState()==1 && agentInfo.getAgentType()==2) {
                            String room = agentInfo.getRoom();
                            AdminUserBetRecord betRecord = new AdminUserBetRecord();
                            betRecord.setRoom(room);
                            betRecord.setPeriod(notPrizeRecord.getPeriod());
                            List<AdminUserBetRecord> adminUserBetRecords = iAdminUserBetRecordService.selectAdminUserBetRecordByPeriodAndRoomInfo(betRecord);
                            //该代理投注的所有金额
                            Double sumPrice = iAdminUserBetRecordService.selectAllSumPriceByPeriodAndRoom(betRecord);
                            List<HashMap<String, Object>> userBetRecords = iAdminUserBetRecordService.selectAdminUserBetRecordGroupByPayNum(betRecord);
                            double pumpPrice = 0;
                            double remainPrice = 0;
                            if (sumPrice != null) {
                                //抽水金额多位小数
                                Double moreV = sumPrice * new Double(agentInfo.getOdds().toString());
                                //代理抽水金额
                                pumpPrice = new Double(String.format("%.2f", moreV));
                                //                            pumpPrice = sumPrice * new Double(agentInfo.getOdds().toString());
                                //剩余金额
                                remainPrice = sumPrice - pumpPrice;
                            } else {
                                sumPrice = new Double(0);
                            }
                            String sendMsg = "开奖期数：" + notPrizeRecord.getPeriod() + "\n";
                            AdminWeixinUser priceRoom =new AdminWeixinUser();
                            priceRoom.setRoom(room);
                            Double weiPrice = iAdminWeixinUserService.selectUserPriceByRoom(priceRoom);
                            sendMsg = sendMsg + "总榜：(" + weiPrice + ")\n";
                            Map<String, String> userMap = new LinkedHashMap<>();
                            for (AdminUserBetRecord adminUserBetRecord : adminUserBetRecords) {
                                if (userMap.get(adminUserBetRecord.getWexinId()) == null) {
                                    userMap.put(adminUserBetRecord.getWexinId(), adminUserBetRecord.getCommand());
                                } else {
                                    userMap.put(adminUserBetRecord.getWexinId(), userMap.get(adminUserBetRecord.getWexinId()) + "，" + adminUserBetRecord.getCommand());
                                }
                            }
                            for (String key : userMap.keySet()) {
                                AdminWeixinUser adminWeixinUser1 = new AdminWeixinUser();
                                adminWeixinUser1.setRoom(room);
                                adminWeixinUser1.setWexinId(key);
                                AdminWeixinUser adminWeixinUser = iAdminWeixinUserService.selectAdminWeixinUserByWeChatIdAndRoom(adminWeixinUser1);
                                sendMsg = sendMsg + "(" + adminWeixinUser.getWexinName() + ")  " + "\"" + userMap.get(key) + "\"" + "\n";
                                System.out.println(key);
                            }
                            sendMsg = sendMsg + "----------------------" + "\n";
                            sendMsg = sendMsg + "总和:" + sumPrice ;
                            sendMsg = sendMsg + "----------------------" + "\n";
                            sendMsg = sendMsg + "以核对列表为效" + "\n";
                            sendMsg = sendMsg + "不在列表都无效" + "\n";
                            sendMsg = sendMsg.replaceAll("\\+", "%2B");
                            AdminPrizeRecord updatePrizeRecord = new AdminPrizeRecord();
                            updatePrizeRecord.setRecordId(notPrizeRecord.getRecordId());
                            updatePrizeRecord.setSealingState(2);
                            iAdminPrizeRecordService.updateAdminPrizeRecord(updatePrizeRecord);
                            HttpUtils.sendPost(sendUrl, "sendMsg=" + "停止" + "&room=" + room);
                            HttpUtils.sendPost(sendUrl, "sendMsg=" + sendMsg + "&room=" + room);
                        }
                    }
                }
            }
            //正常开奖流程
            if (notPrizeRecord.getPrizeTime().getTime() < DateUtils.getNowDate().getTime()) {
                String sendMsg = "开奖期数：" + notPrizeRecord.getPeriod() + "\n";
//                prizeRecord.setPrizeTime(DateUtils.getNowDate());
//                prizeRecord.setRecordId(notPrizeRecord.getRecordId());
//                prizeRecord.setState(2);
//                iAdminPrizeRecordService.updateAdminPrizeRecord(prizeRecord);
                BigDecimal setRemainingPrice = notPrizeRecord.getRemainingPrice();
                //分发奖池金额
//                int[] array = getArray(notPrizeRecord.getLotteryNumber());
//                int[] onArray = Arrays.copyOfRange(array, 0, 5);
                AdminPrizeRecord selectHistoryRecord = new AdminPrizeRecord();
                List<AdminPrizeRecord> adminPrizeRecords = iAdminPrizeRecordService.selectAdminPrizeRecordListToAgentFifty(selectHistoryRecord);
                HashMap hashMap = new HashMap();
                String[] strings=notPrizeRecord.getLotteryNumber().split(",");
                Integer num = Integer.valueOf(strings[7])%4;
                num=num==0?4:num;
                hashMap.put("num",num);

                sendImgOne(hashMap,strings);

                //发图片
                sendImagesMessage(adminPrizeRecords);



                //发开奖记录
                sendAllMessageToRoom(notPrizeRecord);

                sendTwoMessageToRoom(notPrizeRecord.getPeriod()+1);

                //发送开始下注
                try {
                    Thread.sleep(1000L);
                    sendToStartToRoom(notPrizeRecord.getPeriod()+1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } else {
                return;
            }
        }
        if (stateInfo.getConfigValue().equals("2")) {
            return;
        }
        if (Integer.valueOf(stringObjectMap.get("count").toString()).intValue() == 0) {
            return;
        }

//        AdminPrizeRecord prizeInfo = iAdminPrizeRecordService.getMinPrizeInfoByPeriod();
//        AdminPrizeRecord adminPrizeRecord = new AdminPrizeRecord();
////        AdminPrizeRecord currentPrizeInfo = iAdminPrizeRecordService.getCurrentPrizeInfo();
//
//        Date prizeTime = prizeRecord.getPrizeTime();
//        Date date = DateUtils.addMinutes(prizeTime, Integer.valueOf(intervalInfo.getConfigValue()).intValue());
//        if (date.getTime() < DateUtils.getNowDate().getTime()) {
//            adminPrizeRecord.setPrizeTime(DateUtils.getNowDate());
//        } else {
//            int min = Integer.valueOf(intervalInfo.getConfigValue()).intValue();
//            Date prizeDate = DateUtils.addMinutes(prizeRecord.getPrizeTime(), min);
//            adminPrizeRecord.setPrizeTime(prizeDate);
//        }
//        adminPrizeRecord.setRecordId(prizeInfo.getRecordId());
//        logger.info(adminPrizeRecord.toString());
//        iAdminPrizeRecordService.updateAdminPrizeRecord(adminPrizeRecord);
    }

    public void sendTwoMessageToRoom(Long period) {
        AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
        List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
        String msg="历史参考:" + "\n";
        List<AdminPrizeRecord> AdminPrizeRecord = iAdminPrizeRecordService.selectAdminPrizeRecordLimit();
        Collections.reverse(AdminPrizeRecord);
        Integer[] list = new Integer[50];
        for (int i=0;i<AdminPrizeRecord.size();i++) {
            String s = AdminPrizeRecord.get(i).getLotteryNumber().split(",")[7];
            Integer k = Integer.valueOf(s) % 4;
            k=k==0?4:k;
            if (i>4) {
                list[i-5]=k;
            }
        }
        for (int f=0;f<list.length;f++) {
                if(f==11 || f==23 || f==35 || f==47){
                    msg+=list[f]+"-"+"\n";
                }else if(f==49) {
                    msg+=list[f]+"\n";
                }else{
                    msg+=list[f]+"-";
                }

        }
        msg+="----------------------" + "\n";
        msg+=period + "，开始！";
        if (adminAgentInfos.size() > 0) {
            for (int i = 0; i < adminAgentInfos.size(); i++) {
                if (adminAgentInfos.get(i).getAgentState()==1 && adminAgentInfos.get(i).getAgentType()==2) {
                    String room = adminAgentInfos.get(i).getRoom();
                    try {
                        String finalSendMsg = msg;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room);
                            }
                        }).start();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public void sendImgOne(HashMap hashMap,String[] strings) {
        AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
        List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
        String msg = graphicsStart(new TestTable2().getStartHtml(hashMap,strings));
        if (adminAgentInfos.size() > 0) {
            for (int i = 0; i < adminAgentInfos.size(); i++) {
                if (adminAgentInfos.get(i).getAgentState()==1 && adminAgentInfos.get(i).getAgentType()==2) {
                    String room = adminAgentInfos.get(i).getRoom();
                    try {
                        String finalSendMsg = msg;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room + "&type=" + "img");
                            }
                        }).start();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public void sendImgThree(String html,String room) {
        String msg = TestTable2.graphicsThree(html);
        String finalSendMsg = msg;
        try {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room + "&type=" + "img");
                }
            }).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void sendToStartToRoom(Long period){
        AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
        List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
        String msg="第"+period+"期："+"开始下注！4分钟后封盘";
        if (adminAgentInfos.size() > 0) {
            for (int i = 0; i < adminAgentInfos.size(); i++) {
                if (adminAgentInfos.get(i).getAgentState()==1 && adminAgentInfos.get(i).getAgentType()==2) {
                    String room = adminAgentInfos.get(i).getRoom();
                    try {
                        String finalSendMsg = msg;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room);
                            }
                        }).start();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public void sendImagesMessage(List<AdminPrizeRecord> notPrizeRecord){
        //查询所有代理
        AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
        List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
        List<AdminPrizeRecord> AdminPrizeRecord = iAdminPrizeRecordService.selectAdminPrizeRecordLimit();
        Collections.reverse(AdminPrizeRecord);
        Integer[] list = new Integer[55];
        for (int i=0;i<AdminPrizeRecord.size();i++) {
            String s = AdminPrizeRecord.get(i).getLotteryNumber().split(",")[7];
            Integer k = Integer.valueOf(s) % 4;
            k=k==0?4:k;
            if (i<5) {
                list[(i*11)]=k;
            } else if (i>=5 && i<10) {
                list[1+((i-5)*11)]=k;
            } else if (i>=10 && i<15) {
                list[2+((i-10)*11)]=k;
            }  else if (i>=15 && i<20) {
                list[3+((i-15)*11)]=k;
            }else if (i>=20 && i<25) {
                list[4+((i-20)*11)]=k;
            }else if (i>=25 && i<30) {
                list[5+((i-25)*11)]=k;
            }else if (i>=30 && i<35) {
                list[6+((i-30)*11)]=k;
            }else if (i>=35 && i<40) {
                list[7+((i-35)*11)]=k;
            }else if (i>=40 && i<45) {
                list[8+((i-40)*11)]=k;
            }else if (i>=45 && i<50) {
                list[9+((i-45)*11)]=k;
            }else if (i>=50 && i<55) {
                list[10+((i-50)*11)]=k;
            }
        }
        if (adminAgentInfos.size() > 0) {

            List<List<List<String>>> allValue = new ArrayList<>();
            List<List<String>> allValue2 = new ArrayList<>();
            List<String> titles = new ArrayList<>();
            titles.add("标题可以识汉字不");
            List<List<String>> headers = new ArrayList<>();
            List<String> header = new ArrayList<>();
            header.add("开奖时间");//里面方法写死了头部，要改进去里面改
            header.add("期数");
            header.add("开奖号码");
            headers.add(header);
            for (AdminPrizeRecord record:notPrizeRecord) {
                List<String> allValue1 = new ArrayList<String>();
                int hours = record.getPrizeTime().getHours();
                int minutes = record.getPrizeTime().getMinutes();
                int period=hours*60+minutes;
                int num=period%5;
                period=((period-num)/5)+1;
                String time="";
                if (period<10) {
                    time="00"+period;
                }else if(period<100 && period>=10){
                    time="0"+period;
                }else{
                    time=period+"";
                }
                allValue1.add(time);
                allValue1.add(DateUtils.parseDateToStr("HH:mm", record.getPrizeTime()));
                allValue1.add(record.getLotteryNumber());
                int[] normalArray = getNormalArray(record.getLotteryNumber());
                int endBall = normalArray[7];
                //余数
                int remain = normalArray[7]%4;

                remain=remain==0?4:remain;

                //是否双
                int single = normalArray[7]%2;

                String singleStr = single == 0 ? "双" : "单";

                //是否大
                int normal = normalArray[7]>10?1:0;

                String normalStr = normal == 0 ? "小" : "大";

                String str=remain+","+singleStr+","+normalStr;
                allValue1.add(str);
                allValue2.add(allValue1);
            }
            allValue.add(allValue2);
            String path = null;
            try {
                path = TestTable2.twoHtmlGeneration(allValue, titles, headers,list);
            } catch (Exception e) {
                e.printStackTrace();
            }

            for (int i = 0; i < adminAgentInfos.size(); i++) {
                if (adminAgentInfos.get(i).getAgentState()==1 && adminAgentInfos.get(i).getAgentType()==2) {
                    String room = adminAgentInfos.get(i).getRoom();
                    try {
                        logger.info("===生成澳洲8开奖历史图片===");
                        String finalSendMsg = path;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room + "&type=" + "img");
                            }
                        }).start();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public synchronized void sendBetRecordInRoom(){
        logger.info("--------------澳洲8机器人自动投注-----------------------");
        AdminPrizeRecord notPrizeRecord = iAdminPrizeRecordService.selectAdminPrizeRecordByPrizeTime();
        AdminPrizeConfig intervalInfo = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("interval");
        AdminPrizeConfig sealingTime = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("sealingTime");
        AdminPrizeConfig minUpPrice = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("minUpPrice");
        AdminPrizeConfig maxUpPrice = iAdminPrizeConfigService.selectAdminPrizeConfigByKey("maxUpPrice");
        int sealingTimeValue = Integer.valueOf(sealingTime.getConfigValue()).intValue();
        int intValue = Integer.valueOf(intervalInfo.getConfigValue()).intValue();
        int minUpPriceValue = Integer.valueOf(minUpPrice.getConfigValue()).intValue();
        int maxUpPriceValue = Integer.valueOf(maxUpPrice.getConfigValue()).intValue();
        if (notPrizeRecord==null) {
            return;
        }
        if (notPrizeRecord.getIsRobot()==1) {
            return;
        }
        //大于开始时间 小于封盘时间
        Date sealingDate = DateUtils.addMinutes(notPrizeRecord.getPrizeTime(), -sealingTimeValue);
        Date intValueDate = DateUtils.addMinutes(notPrizeRecord.getPrizeTime(), -intValue);
        if (DateUtils.getNowDate().getTime() > intValueDate.getTime() && DateUtils.getNowDate().getTime() < sealingDate.getTime()) {
            AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
            //用户统计金额
            Map<String, BigDecimal> userPrice = new LinkedHashMap<>();
            Map<String, String> downBranch = new LinkedHashMap<>();
            List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
            if (adminAgentInfos.size() > 0) {
                ExecutorService es3 = Executors.newCachedThreadPool();
                ArrayList<AdminWeixinUser> list = new ArrayList();
                for (AdminAgentInfo agentInfo:adminAgentInfos) {
                    if (agentInfo.getAgentType()==2 && agentInfo.getAgentState()==1) {
                        AdminAgentRobot adminAgentRobot = new AdminAgentRobot();
                        adminAgentRobot.setRoom(agentInfo.getRoom());
                        List<AdminAgentRobot> adminAgentRobots = iAdminAgentRobotService.selectAdminAgentRobotList(adminAgentRobot);
                        if (adminAgentRobots.size() > 0) {

                            for (AdminAgentRobot agentRobot : adminAgentRobots) {
                                SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
                                Date dayTimeStart = null;
                                Date dayTimeEnd = null;
                                boolean timeBool = false;
                                try {
                                    dayTimeStart = df.parse(agentRobot.getBeginTime());
                                    dayTimeEnd = df.parse(agentRobot.getEndTime());
                                    timeBool = DateUtils.timeCalendar(dayTimeStart, dayTimeEnd);
                                } catch (ParseException e) {
                                    e.printStackTrace();
                                    continue;
                                }
                                //若时间在这范围之内就执行
                                if (timeBool) {
                                    //若没有投注记录就新增投注记录
                                    String room = agentRobot.getRoom();
                                    String wexinId = agentRobot.getWexinId();
                                    String wexinName = agentRobot.getWexinName();
                                    //最大余额
                                    Long maxSum = agentRobot.getMaxSum();

                                    AdminUserBetRecord adminUserBetRecord = new AdminUserBetRecord();
                                    adminUserBetRecord.setWexinId(wexinId);
                                    adminUserBetRecord.setRoom(room);
                                    adminUserBetRecord.setPeriod(notPrizeRecord.getPeriod());
                                    //查询用户信息
                                    AdminWeixinUser wexinUser1 = new AdminWeixinUser();
                                    wexinUser1.setRoom(room);
                                    wexinUser1.setWexinId(wexinId);

                                    AdminWeixinUser wexinUserInfo = iAdminWeixinUserService.selectAdminWeixinUserByWeChatIdAndRoom(wexinUser1);
                                    if (userPrice.get(wexinId) == null) {
                                        userPrice.put(wexinId, wexinUserInfo.getPrice());
                                    }
                                    //查看该机器人是否有待审核的下分记录
                                    AdminUpdownBranch adminUpdownBranchDown = new AdminUpdownBranch();
                                    adminUpdownBranchDown.setWexinId(wexinId);
                                    adminUpdownBranchDown.setRoom(room);
                                    adminUpdownBranchDown.setBranchType(2);
                                    adminUpdownBranchDown.setAuditStatus(0);
                                    AdminUpdownBranch updownBranchInfoDown = iAdminUpdownBranchService.selectAdminUpdownBranchByWeixinIdAndRoom(adminUpdownBranchDown);
                                    //下注前如果该机器人的金额大于机器人的最大余额，新增下分记录
                                    if (updownBranchInfoDown == null && wexinUserInfo.getPrice().compareTo(new BigDecimal(maxSum)) > 0) {
                                        String msg = "下分" + wexinUserInfo.getPrice();
                                        try {
                                            String finalSendMsg = msg;
                                            new Thread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    HttpUtils.sendPost(sendUrlTwo, "sendMsg=" + finalSendMsg + "&room=" + room + "&wexinId=" + wexinId);
                                                }
                                            }).start();
                                            if (downBranch.get(wexinId) == null) {
                                                downBranch.put(wexinId, "1");
                                            }
                                        } catch (Exception e) {
                                            e.printStackTrace();
                                        }
                                    }

                                    AdminUpdownBranch adminUpdownBranchDown2 = new AdminUpdownBranch();
                                    adminUpdownBranchDown2.setWexinId(wexinId);
                                    adminUpdownBranchDown2.setRoom(room);
                                    adminUpdownBranchDown2.setBranchType(2);
                                    adminUpdownBranchDown2.setAuditStatus(0);
                                    AdminUpdownBranch updownBranchInfoDown2 = iAdminUpdownBranchService.selectAdminUpdownBranchByWeixinIdAndRoom(adminUpdownBranchDown2);
                                    Double aDouble = iAdminUserBetRecordService.selectSumPriceByPeriodAndRoomAndWexinId(adminUserBetRecord);
                                    //等于零说明此机器人没投过注
                                    if (aDouble.intValue() == 0) {
                                        int betNum = getRandomStartToEnd(agentRobot.getMinBet().intValue(), agentRobot.getMaxBet().intValue());

                                        //查看该机器人投注几注,大于零时就发起投注，和没有待审核的下分记录投注
                                        if (betNum > 0 && updownBranchInfoDown2 == null && downBranch.get(wexinId) == null) {
                                            for (int i = 0; i < betNum; i++) {
                                                //获取随机1-8球
                                                List<String> command = getCommand();
                                                Integer randomStartToEnd = getRandomStartToEnd(1, command.size()-1);
                                                //查询用户信息
                                                AdminWeixinUser adminWeixinUser1 = new AdminWeixinUser();
                                                adminWeixinUser1.setRoom(room);
                                                adminWeixinUser1.setWexinId(wexinId);
                                                AdminWeixinUser userInfo = iAdminWeixinUserService.selectAdminWeixinUserByWeChatIdAndRoom(adminWeixinUser1);
                                                //用户金额
                                                BigDecimal price = userInfo.getPrice();
                                                Long userId = userInfo.getId();
                                                //投注金额
                                                Integer betPrice = mockFloatBetween2(new Float(agentRobot.getMinPrice().toString()), new Float(agentRobot.getMaxPrice().toString()), price);
                                                userPrice.put(wexinId, userPrice.get(wexinId).subtract(new BigDecimal(betPrice)));
                                                if (betPrice != 0 && userPrice.get(wexinId).compareTo(new BigDecimal(0)) > 0) {
                                                    String msg = command.get(randomStartToEnd) + betPrice;
                                                    AdminWeixinUser adminWeixinUser = new AdminWeixinUser();
                                                    adminWeixinUser.setRoom(room);
                                                    adminWeixinUser.setWexinId(wexinId);
                                                    adminWeixinUser.setSendMsg(msg);
                                                    list.add(adminWeixinUser);
                                                } else {
                                                    //查看该机器人是否有待审核的上分记录
                                                    AdminUpdownBranch adminUpdownBranch = new AdminUpdownBranch();
                                                    adminUpdownBranch.setWexinId(wexinId);
                                                    adminUpdownBranch.setRoom(room);
                                                    adminUpdownBranch.setBranchType(1);
                                                    adminUpdownBranch.setAuditStatus(0);
                                                    AdminUpdownBranch updownBranchInfo = iAdminUpdownBranchService.selectAdminUpdownBranchByWeixinIdAndRoom(adminUpdownBranch);
                                                    if (updownBranchInfo == null) {
                                                        Integer upPrice = compareFloatBetween2(new Float(minUpPriceValue), new Float(maxUpPriceValue));
                                                        String msg = "上分" + upPrice;
                                                        AdminWeixinUser adminWeixinUser = new AdminWeixinUser();
                                                        adminWeixinUser.setRoom(room);
                                                        adminWeixinUser.setWexinId(wexinId);
                                                        adminWeixinUser.setSendMsg(msg);
                                                        new Thread(new Runnable() {
                                                            @Override
                                                            public void run() {
                                                                HttpUtils.sendPost(sendUrlTwo, "sendMsg=" + msg + "&room=" + room + "&wexinId=" + wexinId);
                                                            }
                                                        }).start();
                                                    }
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                        }
                    }
                }
                if (list.size() > 0) {
                    ArrayList<AdminWeixinUser> randomList = getRandomList(list);
                    for (AdminWeixinUser user : randomList) {
                        Integer getSleepTime = getRandomStartToEnd(2000, 175000);
                        String room = user.getRoom();
                        String wexinId = user.getWexinId();
                        String sendMsg = user.getSendMsg();
                        String finalSendMsg = sendMsg;
                        //创建线程词
                        es3.submit(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    Thread.sleep(getSleepTime);
                                } catch (InterruptedException e) {
                                    e.printStackTrace();
                                }
                                HttpUtils.sendPost(sendUrlTwo, "sendMsg=" + finalSendMsg + "&room=" + room + "&wexinId=" + wexinId);
                            }
                        });
                    }
                }
//                AdminPrizeRecord updateRecord=new AdminPrizeRecord();
//                updateRecord.setIsRobot(1);
//                updateRecord.setRecordId(notPrizeRecord.getRecordId());
//                iAdminPrizeRecordService.updateAdminPrizeRecord(updateRecord);
            }
        }
    }

    private static int getRandomStartToEnd(int x, int y) {
        int num = -1;
        //说明：两个数在合法范围内，并不限制输入的数哪个更大一些
        if (x < 0 || y < 0) {
            return num;
        } else {
            int max = Math.max(x, y);
            int min = Math.min(x, y);
            int mid = max - min;//求差
            //产生随机数
            num = (int) (Math.random() * (mid + 1)) + min;
        }
        return num;
    }

    public static Integer mockFloatBetween2(Float begin, Float end,BigDecimal price) {
        if (new BigDecimal(begin).compareTo(price)<0) {
            BigDecimal bigDecimal = new BigDecimal(end - begin);
            BigDecimal point = new BigDecimal(Math.random());
            BigDecimal pointBetween = point.multiply(bigDecimal);
            BigDecimal result = pointBetween.add(new BigDecimal(begin)).setScale(2, BigDecimal.ROUND_FLOOR);
            int intValue = result.intValue();
            int i1 = LengthNum(intValue);
            int endNum = getEndNum(i1, intValue);
            return endNum;
        }else{
            return 0;
        }
    }

    public List<String> getCommand(){
        List<String> result = new ArrayList<>();
        AdminLuckyCommand AdminPrizeRecord=new AdminLuckyCommand();
        List<AdminLuckyCommand> adminLuckyCommands = iAdminLuckyCommandService.selectAdminLuckyCommandList(AdminPrizeRecord);
        for (AdminLuckyCommand ad:adminLuckyCommands) {
            String[] commands = ad.getCommand().split("、");
            String command = commands[0];
            String str="";
            if (command.contains("番") || command.contains("翻") || command.contains("花")
                    || command.contains("番头")) {
                //1. 番、翻、花、番头

                for (int i=1;i<=4;i++){
                    str=i+command;
                    result.add(str);
                }
            }else if (command.contains("角") || command.contains("架桥")) {
                //2. 角、架桥
                result.add(12+command);
                result.add(23+command);
                result.add(34+command);
                result.add(14+command);
                result.add(24+command);
            }else if (command.contains("车") || command.contains("推车") || command.contains("挨车")
                    || command.contains("三门")) {
                //3. 车、推车、挨车、三门
                for (int i=1;i<=4;i++){
                    str=i+command;
                    result.add(str);
                }
            }else if ((command.contains("念") || command.contains("严") || command.contains("粘") || command.contains("念头")) && !command.contains("加念") ) {
                //4. 念、严、粘、念头
                result.add(1+command+2+"/");
                result.add(2+command+3+"/");
                result.add(3+command+4+"/");
                result.add(1+command+4+"/");
                result.add(2+command+4+"/");
            }else if (command.contains("加念")) {
                //5. 加念
                result.add(1+"念"+23+"/");
                result.add(1+"念"+34+"/");
                result.add(1+"念"+24+"/");
                result.add(2+"念"+14+"/");
                result.add(2+"念"+34+"/");
                result.add(2+"念"+13+"/");
                result.add(3+"念"+12+"/");
                result.add(3+"念"+14+"/");
                result.add(3+"念"+24+"/");
                result.add(4+"念"+23+"/");
                result.add(4+"念"+12+"/");
                result.add(4+"念"+13+"/");
            }else if (command.contains("堂") || command.contains("唐") || command.contains("正") || command.contains("堂头")) {
                //6. 堂、唐、正、堂头
                for (int i=1;i<=4;i++){
                    str=i+command;
                    result.add(str);
                }
            }else if (command.contains("通")) {
                //7. 通
                result.add(1+command+23+"/");
                result.add(1+command+34+"/");
                result.add(1+command+24+"/");
                result.add(2+command+14+"/");
                result.add(2+command+34+"/");
                result.add(2+command+13+"/");
                result.add(3+command+12+"/");
                result.add(3+command+14+"/");
                result.add(3+command+24+"/");
                result.add(4+command+23+"/");
                result.add(4+command+12+"/");
                result.add(4+command+13+"/");
            }else if (command.contains("单") || command.contains("双")) {
                //8. 单、双
                result.add("单");
                result.add("双");
            }else if (command.contains("大") || command.contains("小")) {
                //9. 大、小
                result.add("大");
                result.add("小");
            }else if (command.contains("特码")) {
                //10. 特码
                result.add(3+command+12+"/");
            }
        }
        return result;
    }

    public int[] getNormalArray(String lotteryNumber){
        String[] split = lotteryNumber.split(",");
        int[] array = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            array[i] = Integer.valueOf(split[i]).intValue();
        }
        return array;
    }

    public int[] getPosition (String lotteryNumber){
        String[] split = lotteryNumber.split(",");
        int[] array = new int[split.length];
        int[] startArray = new int[split.length];
        int[] returnArray = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            array[i] = Integer.valueOf(split[i]).intValue();
            startArray[i] = Integer.valueOf(split[i]).intValue();
        }
        int temp;
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if (array[i] < array[j]) {
                    temp = array[i];
                    array[i] = array[j];
                    array[j] = temp; // 两个数交换位置
                }
            }
        }
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < startArray.length; j++) {
                if (startArray[j] == array[i]) {
                    returnArray[i] = j + 1;
                }
            }
        }
        return returnArray;
    }



    public void   sendAllMessageToRoom(AdminPrizeRecord notPrizeRecord){
        int[] normalArray = getNormalArray(notPrizeRecord.getLotteryNumber());
        int endBall = normalArray[7];
        //余数
        int remain = normalArray[7]%4;

        remain=remain==0?4:remain;

        //是否双
        int single = normalArray[7]%2;

        String singleStr = single == 0 ? "双" : "单";

        //是否大
        int normal = normalArray[7]>10?1:0;

        String normalStr = normal == 0 ? "小" : "大";
        //查询所有代理
        AdminAgentInfo adminAgentInfo = new AdminAgentInfo();
        List<AdminAgentInfo> adminAgentInfos = iAdminAgentInfoService.selectAdminAgentInfoList(adminAgentInfo);
        if (adminAgentInfos.size() > 0) {
            for (int i = 0; i < adminAgentInfos.size(); i++) {
                if (adminAgentInfos.get(i).getAgentState()==1 && adminAgentInfos.get(i).getAgentType()==2) {
                    String sendMsg = "开奖期数：" + notPrizeRecord.getPeriod() + "\n";
                    sendMsg = sendMsg + "开奖号码：" + Arrays.toString(normalArray) + "\n";
                    sendMsg = sendMsg + endBall+"=>"+remain+","+singleStr+","+normalStr+","+ "\n";
                    sendMsg = sendMsg + "----------------------" + "\n";
                    AdminWeixinUser priceRoom =new AdminWeixinUser();
                    priceRoom.setRoom(adminAgentInfos.get(i).getRoom());
                    Double weiPrice = iAdminWeixinUserService.selectUserPriceByRoom(priceRoom);
                    sendMsg = sendMsg + "总榜：(" + weiPrice + ")\n";
                    String room = adminAgentInfos.get(i).getRoom();
                    BigDecimal odds = adminAgentInfos.get(i).getOdds();
                    Long id = adminAgentInfos.get(i).getId();
                    BigDecimal agentPrice = adminAgentInfos.get(i).getPrice();
                    AdminUserBetRecord adminUserBetRecord = new AdminUserBetRecord();
                    adminUserBetRecord.setRoom(room);
                    adminUserBetRecord.setPeriod(notPrizeRecord.getPeriod());
                    AdminUserBetRecord betRecordToAllPrice = new AdminUserBetRecord();
                    betRecordToAllPrice.setRoom(room);
                    betRecordToAllPrice.setPeriod(notPrizeRecord.getPeriod());
                    //该代理投注的所有金额
                    Double sumPrice = iAdminUserBetRecordService.selectAllSumPriceByPeriodAndRoom(betRecordToAllPrice);
                    if (sumPrice == null) {
                        //把没投注的玩家也展示出来
                        AdminWeixinUser roomUser = new AdminWeixinUser();
                        roomUser.setRoom(room);
                        List<AdminWeixinUser> adminWeixinUsers = iAdminWeixinUserService.selectAdminWeixinUserByRoom(roomUser);
                        for (AdminWeixinUser user : adminWeixinUsers) {
                            sendMsg = sendMsg + user.getWexinName() + "[" + user.getPrice() + "]：" + "\n";
                        }
                        String finalSendMsg = sendMsg;
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room);
                            }
                        }).start();
                        continue;
                    }
                    //抽水金额多位小数
                    Double moreV = sumPrice * new Double(odds.toString());
                    //代理抽水金额
                    Double v = new Double(String.format("%.2f", moreV));
                    //修改抽水几率
                    AdminPumpRecord adminPumpRecord = new AdminPumpRecord();
                    adminPumpRecord.setPrice(new BigDecimal(v));
                    adminPumpRecord.setPeriod(notPrizeRecord.getPeriod());
                    adminPumpRecord.setRoom(room);
                    iAdminPumpRecordService.updateAdminPumpRecordByPeriodAndRoom(adminPumpRecord);
                    //修改代理余额
                    AdminAgentInfo updateAgentInfo = new AdminAgentInfo();
                    updateAgentInfo.setId(id);
                    updateAgentInfo.setPrice(agentPrice.add(new BigDecimal(v)));
                    updateAgentInfo.setUpdateTime(DateUtils.getNowDate());
                    iAdminAgentInfoService.updateAdminAgentInfo(updateAgentInfo);
                    //剩余金额
                    Double remainPrice = sumPrice - sumPrice * new Double(odds.toString());
                    //用户统计金额
                    Map<String, BigDecimal> userPrice = new LinkedHashMap<>();
                    HashMap<String,String> userMap = new HashMap();
                    HashMap<String,BigDecimal> userPriceMap = new HashMap();
                    HashMap<String,String> nameMap = new HashMap();
                    Double bDouble = iAdminUserBetRecordService.selectLuckSumPrice(adminUserBetRecord);
                    if (bDouble != null && bDouble > 0) {
                        List<AdminUserBetRecord> userBetRecords = iAdminUserBetRecordService.selectLuckUserBetRecord(adminUserBetRecord);
                        for (AdminUserBetRecord userBetRecord:userBetRecords) {
                            String wexinId = userBetRecord.getWexinId();
                            if (nameMap.get(wexinId)==null) {
                                nameMap.put(wexinId,userBetRecord.getWexinName());
                            }
                            if (userMap.get(wexinId)==null) {
                                userMap.put(wexinId,userBetRecord.getCommand());
                            }else {
                                userMap.put(wexinId,userMap.get(wexinId)+","+userBetRecord.getCommand());
                            }

                            if (userPrice.get(wexinId)==null) {
                                userPrice.put(wexinId,userBetRecord.getPayPrice());
                            }else {
                                userPrice.put(wexinId,new BigDecimal(userPrice.get(wexinId).toString()).add(userBetRecord.getPayPrice()));
                            }
                        }
                    }
                    String  sendMessageOne= "----------------------" + "<br>";
                    sendMessageOne+= notPrizeRecord.getPeriod()+"结果：" + Arrays.toString(normalArray) + "<br>";
                    sendMessageOne+= endBall+"=>"+remain+","+singleStr+","+normalStr+","+ "<br>";

                    sendMessageOne+="获胜名单:"+"<br>";
                    HashMap<String,String> person=new HashMap();
                    HashMap<String,Double> flowerMap=new HashMap();
                    for (String key : userMap.keySet()) {
                        String str = userMap.get(key);
                        String[] split = str.split(",");
                        String regx="";
                        int startNum = 0;
                        String command="";
                        Double endNum = 0.00;

                        int numOne=0;
                        int numTwo=0;
                        int numThree=0;

                        for (String luck:split) {
                            Double endPrice = 0.00;
                            if (luck.contains("番") || luck.contains("翻") || luck.contains("花")
                                    || luck.contains("番头")) {
                                if (luck.contains("番头")){
                                    command="番头";
                                    startNum= luck.indexOf("番头");
                                }else if(luck.contains("番")){
                                    command="番";
                                    startNum= luck.indexOf("番");
                                }else if(luck.contains("翻")){
                                    command="翻";
                                    startNum= luck.indexOf("翻");
                                }else if(luck.contains("花")){
                                    command="花";
                                    startNum= luck.indexOf("花");
                                }
                                String firstOne=luck.substring(0,startNum);
                                String firstTwo = firstOne.replaceAll(command, "");
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                numOne=Integer.valueOf(firstTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("番");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                if (numOne==remain) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }

                                //1. 番、翻、花、番头


                            }else if (luck.contains("角") || luck.contains("架桥") ) {
                                //2. 角、架桥
                                if (luck.contains("角")){
                                    command="角";
                                    startNum= luck.indexOf("角");
                                }else if(luck.contains("架桥")){
                                    command="架桥";
                                    startNum= luck.indexOf("架桥");
                                }
                                String first=luck.substring(0,1);
                                String firstOne=luck.substring(1,2);
                                String firstTwo = firstOne.replaceAll(command, "");
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                int numFirst=Integer.valueOf(first);
                                numOne=Integer.valueOf(firstTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("角");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                if (numOne==remain || numFirst==remain) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }
                            }else if (luck.contains("车") || luck.contains("推车") || luck.contains("挨车")
                                    || luck.contains("三门")) {
                                //3. 车、推车、挨车、三门
                                if (luck.contains("推车")){
                                    command="推车";
                                    startNum= luck.indexOf("推车");
                                }else if(luck.contains("挨车")){
                                    command="挨车";
                                    startNum= luck.indexOf("挨车");
                                }else if(luck.contains("三门")){
                                    command="三门";
                                    startNum= luck.indexOf("三门");
                                }else if(luck.contains("车")){
                                    command="车";
                                    startNum= luck.indexOf("车");
                                }
                                String firstOne=luck.substring(0,startNum);
                                String firstTwo = firstOne.replaceAll(command, "");
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                numOne=Integer.valueOf(firstTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("车");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                int reverse=getReverseNum(remain);
                                if (numOne!=reverse) {
                                    if (!key.contains("robot")) {
                                        AdminUserBetRecord newBet = new AdminUserBetRecord();
                                        newBet.setRoom(room);
                                        newBet.setPeriod(notPrizeRecord.getPeriod());
                                        newBet.setWexinId(key);
                                        newBet.setCommand(luck);
                                        AdminUserBetRecord getBetRecord = iAdminUserBetRecordService.selectAdminUserBetRecordByPeriodAndRoomAndCommand(newBet);

                                        AdminUserFlowing adminUserFlowing = iAdminUserFlowingService.selectAdminUserFlowingByBetId(getBetRecord.getId());
                                        AdminUserFlowing updateFlowing = new AdminUserFlowing();
                                        updateFlowing.setPayPrice(adminUserFlowing.getPayPrice().divide(new BigDecimal(3), 2, BigDecimal.ROUND_HALF_UP));
                                        updateFlowing.setId(adminUserFlowing.getId());
                                        iAdminUserFlowingService.updateAdminUserFlowing(updateFlowing);
                                    }
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }

                            }else if (luck.contains("念") || luck.contains("严") || luck.contains("粘")
                                    || luck.contains("念头")) {
                                //4. 念、严、粘、念头
                                regx="^([1-4])((念头)|(念)|(严)|(粘))(?!\\1)([1-4])/((?:[1-9][0-9]\\d*))$";
                                boolean regexState = getRegex(regx, luck);
                                if (regexState) {
                                    if (luck.contains("念头")) {
                                        command = "念头";
                                        startNum = luck.indexOf("念头");
                                    } else if (luck.contains("严")) {
                                        command = "严";
                                        startNum = luck.indexOf("严");
                                    } else if (luck.contains("粘")) {
                                        command = "粘";
                                        startNum = luck.indexOf("粘");
                                    } else if (luck.contains("念")) {
                                        command = "念";
                                        startNum = luck.indexOf("念");
                                    }
                                    String first = luck.substring(0, 1);
                                    String firstTwo = luck.replaceAll(command, "");
                                    String firstOne = firstTwo.substring(1, 2);
                                    String commandTwo = "/";
                                    startNum = luck.indexOf(commandTwo);
                                    String strOne = luck.substring(startNum, luck.length());
                                    String strTwo = strOne.replaceAll(commandTwo, "");
                                    endNum = Double.valueOf(strTwo);
                                    int numFirst = Integer.valueOf(first);
                                    numOne = Integer.valueOf(firstOne);

                                    AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("念头");
                                    BigDecimal winPercent = luckyCommand.getWinPercent();
                                    if (numFirst == remain) {
                                        endPrice = new Double(String.format("%.2f", winPercent.doubleValue() * endNum));
                                    } else if (numOne == remain) {
                                        endPrice = endNum;
                                        flowerMap.put(key,endPrice);
                                    }
                                }else{
                                    //5. 加念
                                    regx="^([1-4])(念)(?!\\1)([1-4])(?!\\1|\\3)([1-4])/((?:[1-9][0-9]\\d*))$";
                                    regexState = getRegex(regx, luck);
                                    if (regexState) {
                                        if (luck.contains("念")){
                                            command="念";
                                            startNum= luck.indexOf("念");
                                        }
                                        String first=luck.substring(0,1);
                                        String firstTwo = luck.replaceAll(command, "");

                                        String commandTwo="/";
                                        startNum= luck.indexOf(commandTwo);
                                        String strOne=luck.substring(startNum,luck.length());
                                        String strTwo = strOne.replaceAll(commandTwo, "");
                                        endNum = Double.valueOf(strTwo);
                                        int numFirst=Integer.valueOf(first);
                                        numOne=Integer.valueOf(firstTwo.substring(1,2));
                                        numTwo=Integer.valueOf(firstTwo.substring(2,3));
                                        AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("加念");
                                        BigDecimal winPercent = luckyCommand.getWinPercent();
                                        if (numFirst==remain) {
                                            endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                        }else if (numOne==remain || numTwo==remain){
                                            endPrice=endNum;
                                            flowerMap.put(key,endPrice);
                                        }
                                    }

                                }
                            }else if (luck.contains("堂") || luck.contains("唐") || luck.contains("正")
                                    || luck.contains("堂头")) {
                                //6. 堂、唐、正、堂头
                                if (luck.contains("堂头")){
                                    command="堂头";
                                    startNum= luck.indexOf("堂头");
                                }else if(luck.contains("堂")){
                                    command="堂";
                                    startNum= luck.indexOf("堂");
                                }else if(luck.contains("唐")){
                                    command="唐";
                                    startNum= luck.indexOf("唐");
                                }else if(luck.contains("正")){
                                    command="正";
                                    startNum= luck.indexOf("正");
                                }
                                String firstOne=luck.substring(0,startNum);
                                String firstTwo = firstOne.replaceAll(command, "");
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                numOne=Integer.valueOf(firstTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("堂头");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                BigDecimal water = luckyCommand.getWater();

                                int reverse=0;

                                reverse=getReverseNum(remain);
                                if (numOne==remain) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }else if(numOne!=reverse){ endPrice=new Double(String.format("%.2f",endNum));
                                    endPrice=new Double(String.format("%.2f",endNum));
                                    flowerMap.put(key,endPrice);
                                }
                            }else if (luck.contains("通")) {
                                //7. 通
                                if (luck.contains("通")){
                                    command="通";
                                    startNum= luck.indexOf("通");
                                }
                                String first=luck.substring(0,1);
                                String firstOne=luck.substring(startNum+1,startNum+3);
                                String commandTwo="/";
                                startNum= luck.indexOf(commandTwo);
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(commandTwo, "");
                                endNum = Double.valueOf(strTwo);
                                int numFirst=Integer.valueOf(first);
                                numOne=Integer.valueOf(firstOne.substring(0,1));
                                numTwo=Integer.valueOf(firstOne.substring(1,2));
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("通");
                                BigDecimal winPercent = luckyCommand.getWinPercent();

                                if (numOne ==remain ||  numTwo ==remain) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }else if (numFirst!=remain){
                                    endPrice=endNum;
                                    flowerMap.put(key,endPrice);
                                }

                            }else if (luck.contains("单") || luck.contains("双")) {
                                if (luck.contains("单")){
                                    command="单";
                                    startNum= luck.indexOf("单");
                                }else if(luck.contains("双")){
                                    command="双";
                                    startNum= luck.indexOf("双");
                                }

                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("单");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                if (command.equals(singleStr)) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }
                            }else if (luck.contains("大") || luck.contains("小")) {
                                //9. 大、小
                                if (luck.contains("大")){
                                    command="大";
                                    startNum= luck.indexOf("大");
                                }else if(luck.contains("小")){
                                    command="小";
                                    startNum= luck.indexOf("小");
                                }

                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");
                                endNum = Double.valueOf(strTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("小");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                if (command.equals(normalStr)) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }
                            }else if (luck.contains("特")) {
                                //10. 特码
                                command="特";
                                startNum= luck.indexOf("特");
                                String strOne=luck.substring(startNum,luck.length());
                                String strTwo = strOne.replaceAll(command, "");

                                String strThree=luck.substring(0,startNum);
                                String[] strFour = strOne.replaceAll(command, "").split("\\/");
                                String[] split1 = strThree.split("/");
                                endNum = Double.valueOf(strTwo);
                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("特");
                                BigDecimal winPercent = luckyCommand.getWinPercent();
                                boolean state=false;
                                for (String s:split1) {
                                    Integer integer = Integer.valueOf(s);
                                    if (integer==endBall) {
                                        state=true;
                                    }
                                }
                                if (state) {
                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                }
                            }else{
                                regx="^([1-4])(?!\\1)([1-4])/((?:[1-9][0-9]{0,11}))$";
                                boolean regexState = getRegex(regx, luck);
                                BigDecimal winPercent =new BigDecimal(0);
                                command="/";
                                if (regexState) {
                                    String first=luck.substring(0,1);
                                    String firstOne=luck.substring(1,2);
                                    startNum = luck.indexOf(command);
                                    String strOne=luck.substring(startNum,luck.length());
                                    String strTwo = strOne.replaceAll(command, "");
                                    endNum = Double.valueOf(strTwo);
                                    int numFirst=Integer.valueOf(first);
                                    numOne=Integer.valueOf(firstOne);
                                    AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("角");
                                    winPercent = luckyCommand.getWinPercent();
                                    if (numOne==remain || numFirst==remain) {
                                        endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                    }
                                }else {
                                    regx="^([1-4])(\\+)(?!\\1)([1-4])/((?:[1-9][0-9]\\d*))$";
                                    regexState = getRegex(regx, luck);
                                    if (regexState) {
                                        command="\\+";
                                        String first = luck.substring(0, 1);
                                        String firstTwo = luck.replaceAll(command, "");
                                        String firstOne = firstTwo.substring(1, 2);
                                        String commandTwo = "/";
                                        startNum = luck.indexOf(commandTwo);
                                        String strOne = luck.substring(startNum, luck.length());
                                        String strTwo = strOne.replaceAll(commandTwo, "");
                                        endNum = Double.valueOf(strTwo);
                                        int numFirst = Integer.valueOf(first);
                                        numOne = Integer.valueOf(firstOne);

                                        AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("念头");
                                        winPercent = luckyCommand.getWinPercent();
                                        if (numFirst == remain) {
                                            endPrice = new Double(String.format("%.2f", winPercent.doubleValue() * endNum));
                                        } else if (numOne == remain) {
                                            endPrice = endNum;
                                            flowerMap.put(key,endPrice);
                                        }

                                    }else {
                                        command="/";
                                        regx="^([1-4])/((?:[1-9][0-9]\\d*))$";
                                        regexState = getRegex(regx, luck);
                                        if (regexState) {
                                            String firstOne=luck.substring(0,1);
                                            startNum= luck.indexOf(command);
                                            String strOne=luck.substring(startNum,luck.length());
                                            String strTwo = strOne.replaceAll(command, "");
                                            endNum = Double.valueOf(strTwo);
                                            numOne=Integer.valueOf(firstOne);
                                            AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("番");
                                            winPercent = luckyCommand.getWinPercent();
                                            if (numOne==remain) {
                                                endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                            }
                                        }else {
                                            command="\\+";
                                            regx="^([1-4])(\\+)(?!\\1)([1-4])(?!\\1|\\3)([1-4])/((?:[1-9][0-9]\\d*))$";
                                            regexState = getRegex(regx, luck);
                                            if (regexState) {
                                                String first=luck.substring(0,1);
                                                String firstTwo = luck.replaceAll(command, "");

                                                String commandTwo="/";
                                                startNum= luck.indexOf(commandTwo);
                                                String strOne=luck.substring(startNum,luck.length());
                                                String strTwo = strOne.replaceAll(commandTwo, "");
                                                endNum = Double.valueOf(strTwo);
                                                int numFirst=Integer.valueOf(first);
                                                numOne=Integer.valueOf(firstTwo.substring(1,2));
                                                numTwo=Integer.valueOf(firstTwo.substring(2,3));
                                                AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("加念");
                                                winPercent = luckyCommand.getWinPercent();
                                                if (numFirst==remain) {
                                                    endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                                }else if (numOne==remain || numTwo==remain){
                                                    endPrice=endNum;
                                                    flowerMap.put(key,endPrice);
                                                }
                                            }else{
                                                regx="^([1-4])(?!\\1)([1-4])(-)(?!\\1|\\2)([1-4])/((?:[1-9][0-9]\\d*))$";
                                                regexState = getRegex(regx, luck);
                                                if (regexState) {
                                                    String first=luck.substring(0,1);
                                                    String commandTwo="/";
                                                    startNum= luck.indexOf(commandTwo);
                                                    String strOne=luck.substring(startNum,luck.length());
                                                    String strTwo = strOne.replaceAll(commandTwo, "");
                                                    endNum = Double.valueOf(strTwo);
                                                    int numFirst=Integer.valueOf(first);
                                                    numOne=Integer.valueOf(luck.substring(1,2));
                                                    numTwo=Integer.valueOf(luck.substring(3,4));
                                                    AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("通");
                                                    winPercent = luckyCommand.getWinPercent();

                                                    if (numFirst ==remain ||  numOne ==remain) {
                                                        endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                                    }else if (numTwo!=remain){
                                                        endPrice=endNum;
                                                        flowerMap.put(key,endPrice);
                                                    }
                                                }else{
                                                    regx="^([1-4])(-)(?!\\1)([1-4])/((?:[1-9][0-9]\\d*))$";
                                                    regexState = getRegex(regx, luck);
                                                    if (regexState) {
                                                        String firstOne=luck.substring(0,1);
                                                        String firstTwo=luck.substring(2,3);
                                                        command="/";
                                                        startNum= luck.indexOf(command);
                                                        String strOne=luck.substring(startNum,luck.length());
                                                        String strTwo = strOne.replaceAll(command, "");
                                                        endNum = Double.valueOf(strTwo);
                                                        numOne=Integer.valueOf(firstOne);
                                                        numTwo=Integer.valueOf(firstTwo);
                                                        AdminLuckyCommand luckyCommand = luckyCommandService.selectAdminLuckyCommandByCommand("堂头");
                                                        winPercent = luckyCommand.getWinPercent();
                                                        BigDecimal water = luckyCommand.getWater();

                                                        int reverse=0;

                                                        reverse=getReverseNum(remain);
                                                        if (numOne==remain) {
                                                            endPrice=new Double(String.format("%.2f",winPercent.doubleValue()*endNum));
                                                        }else if(numTwo!=remain){
                                                            endPrice=new Double(String.format("%.2f",endNum-water.doubleValue()*endNum));
                                                        }
                                                    }
                                                }
                                            }

                                        }
                                    }
                                }

                            }
                            if (endPrice>0) {
                                if (person.get(key)==null) {
                                    person.put(key,nameMap.get(key));
                                    sendMessageOne+="("+nameMap.get(key)+")";
                                }
                                sendMessageOne+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+luck+"”"+"盈:"+endPrice+"<br>";
                            }
                            if (userPriceMap.get(key)==null) {
                                userPriceMap.put(key,new BigDecimal(endPrice));
                            }else {
                                userPriceMap.put(key,new BigDecimal(userPriceMap.get(key).toString()).add(new BigDecimal(endPrice)));
                            }
                        }

//                            double endBigDecimal = endPrice - new Double(userPriceMap.get(key).toString());
//                            endBigDecimal=new Double(String.format("%.2f",endBigDecimal));

                    }
                    sendMessageOne+="----------------------"+"<br>";
                    String s = DateUtils.parseDateToStr("yyyy/MM/dd HH:mm:ss", DateUtils.getNowDate());
                    sendMessageOne+="时间:"+s;
                    sendImgThree(sendMessageOne,room);
                    String sendMsg2 = "";
                    ArrayList<WeChatUser> persons = new ArrayList<WeChatUser>();
                    //遍历用户盈利标志
                    for (String key : userPriceMap.keySet()) {
                        //统计用户在这期投了多少钱


                        //开奖返回金额
                        AdminWeixinUser weixinUser1 = new AdminWeixinUser();
                        weixinUser1.setWexinId(key);
                        weixinUser1.setRoom(room);
                        AdminWeixinUser weixinUser2 = iAdminWeixinUserService.selectAdminWeixinUserByWeChatIdAndRoom(weixinUser1);
                        AdminWeixinUser updateWeixinUser = new AdminWeixinUser();
                        updateWeixinUser.setId(weixinUser2.getId());
                        updateWeixinUser.setPrice(weixinUser2.getPrice().add(userPriceMap.get(key)));
                        updateWeixinUser.setUpdateTime(DateUtils.getNowDate());
                        iAdminWeixinUserService.updateAdminWeixinUser(updateWeixinUser);


                        //查询用户最新金额
                        AdminWeixinUser adminWeixinUser1 = new AdminWeixinUser();
                        adminWeixinUser1.setWexinId(key);
                        adminWeixinUser1.setRoom(room);
                        AdminWeixinUser adminWeixinUser = iAdminWeixinUserService.selectAdminWeixinUserByWeChatIdAndRoom(adminWeixinUser1);

                        //记录用户流水
                        if (weixinUser2.getIsRobot()==0) {
                            if (flowerMap.get(key)==null) {
                                AdminUserFlowing adminUserFlowing = new AdminUserFlowing();
                                adminUserFlowing.setUpdateTime(DateUtils.getNowDate());
                                adminUserFlowing.setStartPrice(weixinUser2.getPrice());
                                adminUserFlowing.setPayPrice(userPriceMap.get(key));
                                adminUserFlowing.setEndPrice(adminWeixinUser.getPrice());
                                adminUserFlowing.setUserId(adminWeixinUser.getId());
                                adminUserFlowing.setWexinId(adminWeixinUser.getWexinId());
                                adminUserFlowing.setWexinName(adminWeixinUser.getWexinName());
                                adminUserFlowing.setIsFlowing(1);
                                adminUserFlowing.setPayType(2);
                                adminUserFlowing.setRoom(room);
                                adminUserFlowing.setRemark("开奖返回金额");
                                adminUserFlowing.setPeriod(notPrizeRecord.getPeriod().intValue());
                                iAdminUserFlowingService.insertAdminUserFlowing(adminUserFlowing);
                            }else {
                                AdminUserFlowing flowing = new AdminUserFlowing();
                                flowing.setPayPrice(new BigDecimal(flowerMap.get(key).toString()));
                                flowing.setWexinId(key);
                                flowing.setRoom(room);
                                flowing.setPeriod(notPrizeRecord.getPeriod().intValue());
                                iAdminUserFlowingService.deleteAdminUserFlowingByRoomAndPriceAndWeixinId(flowing);
                                AdminUserFlowing adminUserFlowing = new AdminUserFlowing();
                                adminUserFlowing.setUpdateTime(DateUtils.getNowDate());
                                adminUserFlowing.setStartPrice(weixinUser2.getPrice());
                                adminUserFlowing.setPayPrice(userPriceMap.get(key));
                                adminUserFlowing.setEndPrice(adminWeixinUser.getPrice());
                                adminUserFlowing.setUserId(adminWeixinUser.getId());
                                adminUserFlowing.setWexinId(adminWeixinUser.getWexinId());
                                adminUserFlowing.setWexinName(adminWeixinUser.getWexinName());
                                adminUserFlowing.setIsFlowing(1);
                                adminUserFlowing.setPayType(2);
                                adminUserFlowing.setRoom(room);
                                adminUserFlowing.setRemark("开奖返回金额");
                                adminUserFlowing.setPeriod(notPrizeRecord.getPeriod().intValue());
                                iAdminUserFlowingService.insertAdminUserFlowing(adminUserFlowing);
                            }
                        }
                        BigDecimal subtract = userPriceMap.get(key).subtract(userPrice.get(key));
                        String str = subtract.compareTo(new BigDecimal(0)) > -1 ? "%2B" : "";
//                    sendMsg = sendMsg + adminWeixinUser.getWexinName() + "[" + adminWeixinUser.getPrice() + "]：(" + str + userPrice.get(key).toString() + ")\n";

                        sendMsg2 = sendMsg2 + adminWeixinUser.getWexinName() + " " + str +  String.format("%.2f",new Double(subtract.toString())) + "\n";
                        WeChatUser weChatUser = new WeChatUser();
                        weChatUser.setOldPrice(adminWeixinUser.getPrice());
                        weChatUser.setWexinName(adminWeixinUser.getWexinName());
                        weChatUser.setPrice(subtract);
                        persons.add(weChatUser);
                    }

                    //把没投注的玩家也展示出来
                    AdminWeixinUser roomUser = new AdminWeixinUser();
                    roomUser.setRoom(room);
                    List<AdminWeixinUser> adminWeixinUsers = iAdminWeixinUserService.selectAdminWeixinUserByRoom(roomUser);
                    for (AdminWeixinUser user : adminWeixinUsers) {
                        if (userPrice.get(user.getWexinId()) == null) {
                            WeChatUser weChatUser = new WeChatUser();
                            weChatUser.setOldPrice(user.getPrice());
                            weChatUser.setWexinName(user.getWexinName());
                            weChatUser.setPrice(new BigDecimal(0));
                            persons.add(weChatUser);
//                        sendMsg = sendMsg + user.getWexinName() + "[" + user.getPrice() +"]："+"\n";
                        }
                    }
                    Collections.sort(persons, new Comparator<WeChatUser>() {
                        @Override
                        public int compare(WeChatUser o1, WeChatUser o2) {
                            return o2.getOldPrice().compareTo(o1.getOldPrice()) > 0 ? 1 : -1;
                        }
                    });
                    for (WeChatUser chatUser : persons) {
                        if (chatUser.getPrice().compareTo(new BigDecimal(0)) != 0) {
                            String str = chatUser.getPrice().compareTo(new BigDecimal(0)) > -1 ? "%2B" : "";
                            sendMsg = sendMsg + chatUser.getWexinName() + "[" +  String.format("%.2f",new Double(chatUser.getOldPrice().toString())) + "]：(" + str + String.format("%.2f",new Double(chatUser.getPrice().toString())) + ")\n";
                        } else {
                            sendMsg = sendMsg + chatUser.getWexinName() + "[" +  String.format("%.2f",new Double(chatUser.getOldPrice().toString())) + "]：" + "\n";
                        }
                    }
                    String finalSendMsg = sendMsg;
                    String finalSendMsg2 = sendMsg2;
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg + "&room=" + room);
                            HttpUtils.sendPost(sendUrl, "sendMsg=" + finalSendMsg2 + "&room=" + room);
                        }
                    }).start();
                }
            }
        }
    }

    public static void main(String[] args) {
//        try {
//            String luck="2念442 332";
////        String regx="^(?:([1-4])){1}((念头)|(念)|(严)|(粘))(?:([1-4])(?<!\\1)){1}(/)((?:[1-9][0-9]\\d*))$";
//            String regx="^([1-4])((念头)|(念)|(严)|(粘))(?!\\1)([1-4])(?!\\1|\\7)([1-4])/((?:[1-9][0-9]\\d*))$";
////            String regx="(?<!re)\\w+";
//
//            boolean regexState = getRegex(regx, luck);
//            System.out.println(regexState);
//        }catch (Exception e){
//            System.out.println(e);
//        }
        int max=1000,min=1000;


        for (int i=0;i<10;i++) {
            int ran2 = (int) (Math.random()*(max-min)+min);
            String d="mao"+i;
            TimerTask task = new TimerTask() {
                @Override
                public void run() {
                    System.out.println(d+"");
                    System.gc();
                }
            };
            Timer timer = new Timer();
            timer.schedule(task,ran2);

        }
        System.out.println(123);
    }

    public static Integer getReverseNum(int remain){
        int reverse=0;
        if (remain==1){
            reverse=3;
        }else if(remain==2){
            reverse=4;
        }else if(remain==3){
            reverse=1;
        }else if(remain==4){
            reverse=2;
        }
      return reverse;
    }

    public static boolean getRegex(String regx,String msg){
        Pattern pattern = Pattern.compile(regx);
        boolean matcher = pattern.matcher(msg).find();

        return matcher;
    }
}
